import { RequestData, GET, POST } from '@/utils/request-data';

const requestData = Object.create(RequestData);
requestData.setBaseUrl('/erp/dealer/store');

// 第三方店铺授权
export const authorizedPage = (params) =>
  requestData.base('/page', POST, params);
// export const authorizedList = () => requestData.base('/list', POST)
export const authorizedList = (params) =>
  requestData.base('/list', POST, params);

export const authorizedDelete = (id) => requestData.base(`/delete/${id}`, POST);
export const authorizedRead = (id) => requestData.base(`/read/${id}`, POST);
export const editShopify = (params) =>
  requestData.base('/edit/shopify', POST, params);
export const editWooc = (params) =>
  requestData.base('/edit/woocommerce', POST, params);
export const editUnknown = (params) =>
  requestData.base('/edit/unknown', POST, params);

export const addShopify = (params) =>
  requestData.base('/add/shopify', POST, params);
export const addWooc = (params) =>
  requestData.base('/add/woocommerce', POST, params);
export const addUnknown = (params) =>
  requestData.base('/add/unknown', POST, params);
export const authorizedAuth = (id) => requestData.base(`/auth/${id}`, POST);
export const authorizedValid = (id) => requestData.base(`/valid/${id}`, POST);

export const productPull = (params) =>
  requestData.base('/product/pull', POST, params);
export const batchPull = (params) =>
  requestData.base('/product/batchPull', POST, params);
export const productPush = (params) =>
  requestData.base('/product/push', POST, params);

export const orderPull = (params) =>
  requestData.base('/order/pull', POST, params);
export const orderPullResult = (params) =>
  requestData.base('/order/pull/result', POST, params);

export const orderSubmit = (params) =>
  requestData.base('/product/order/submit', POST, params);
export const orderConfirm = (params) =>
  requestData.base('/product/order/confirm', POST, params);
export const orderUrgent = (params) =>
  requestData.base('/product/order/urgent', POST, params);
export const orderUnurgent = (params) =>
  requestData.base('/product/order/unurgent', POST, params);
export const orderTrash = (params) =>
  requestData.base('/product/order/trash', POST, params);

// shopify授权回调
export const shopifyCallback = (params) =>
  requestData.base(`/authorized/shopify/callback${params}`, GET);
